<template>
	<view>
		<navbar title=" " leftIcon=" " :autoBack='false'>
			<view class="leftbtn" slot='leftbtn'>
				分享注册
			</view>
			<view class="leftbtn" slot='rightbtn'>
				分享记录
			</view>
		</navbar>
		<scroll-view scroll-y="true" class="scbox1">
			<view class="con">
				<view class="con__box">
					<view class="con__title">
						<image src="/static/goods/titlebg.png" class="con__title__bg" mode=""></image>
						分享须知
						<image src="/static/goods/titlebg.png" class="con__title__bg" mode=""></image>
					</view>
					<view class="con__tips">
						1.分享产生名下用户(永不改变)</br>
						2.分享用户不限名额。 </br>
						3.名下用户在本系统的交易，实时累计财富佣金，认证与续费后可提现。
					</view>
					<view class="u-flex u-flex-y-center u-flex-between">
						<view class="con__item" v-for="(item,index) in list1" :key="index" @click="fx(index)">
							<image :src="'/static/fenx/'+item.icon+'.png'" class="con__item__icon" mode=""></image>
							<view class="con__item__text">
								{{item.text}}
							</view>
						</view>
					</view>
					<view class="con__title" style="margin-bottom: 28rpx;">
						<image src="/static/goods/titlebg.png" class="con__title__bg" mode=""></image>
						软件培训操作视频
						<image src="/static/goods/titlebg.png" class="con__title__bg" mode=""></image>
					</view>
					<view class="u-flex u-flex-y-center u-flex-between u-flex-wrap">
						<view class="" v-for="(item,index) in list2" :key="index">
							<view class="con__sp">
								<image :src="item.url" class="con__sp__bg" mode=""></image>
								<image src="/static/fenx/bf.png" class="con__sp__bf" mode=""></image>
							</view>
							<view class="con__sptext">
								{{item.text}}
							</view>
						</view>
					</view>
				</view>
			</view>
		</scroll-view>
		<u-popup mode="center" :show="show" @close="show=false">
			<view class="" style="margin: 50rpx;">
				<uv-qrcode ref="qrcode" :value="qrlink" size='300rpx'></uv-qrcode>
			</view>
		</u-popup>
		<tabbar :current="1"></tabbar>
	</view>
</template>

<script>
	import user from '@/api/_user.js'
	export default {
		data() {
			return {
				show:false,
				list1: [{
						text: '朋友圈',
						icon: 'pyq'
					},
					{
						text: '微信好友',
						icon: 'wx'
					},
					{
						text: '短信',
						icon: 'yj'
					},
					{
						text: '二维码',
						icon: 'qr'
					},
				],
				list2: [{
						text: '千里眼安装视频',
						url: ''
					},
					{
						text: '全景VR安装培训视频',
						url: ''
					},
					{
						text: '软件启用培训视频',
						url: ''
					},
					{
						text: '手机APP操作培训视频',
						url: ''
					},
				],
				qrlink:this.$store.state.sharelink + '?mobile=' + uni.getStorageSync('88ffuserinfo').mobile
			};
		},
		onLoad() {
			uni.hideTabBar()
		},
		methods: {
			fx(index) {
				// 先登录
				if(!uni.getStorageSync('88ffuserinfo')){
					uni.$u.toast('请先登录')
					setTimeout(() => {
						uni.reLaunch({
							url: '/pages/index/login'
						})
					}, 1000)
					return
				}else{
					if (index == 0) { //朋友圈
						this.topyq()
					}
					if (index == 1) { //好友
						this.tohy()
					}
					if (index == 2) { //短信
						this.sendMsg()
					}
					if (index == 3) { //二维码
						this.show=true
					}
				}
				
			},
			topyq() {
				uni.share({
					provider: "weixin",
					scene: "WXSceneTimeline",
					type: 0,
					href: this.$store.state.sharelink + '?mobile=' + uni.getStorageSync('88ffuserinfo').mobile,
					title: "",
					summary: `来自${uni.getStorageSync('88ffuserinfo').username}分享的 88ff APP 下载注册地址ַ`,
					imageUrl: "/static/logo.png",
					success: function(res) {
						console.log("success:" + JSON.stringify(res));
					},
					fail: function(err) {
						console.log("fail:" + JSON.stringify(err));
					}
				});
			},
			tohy() {
				uni.share({
					provider: "weixin",
					scene: "WXSceneSession",
					type: 0,
					href: this.$store.state.sharelink + '?mobile=' + uni.getStorageSync('88ffuserinfo').mobile,
					title: `来自${uni.getStorageSync('88ffuserinfo').username}分享的 88ff APP 下载注册地址ַ`,
					summary: '',
					imageUrl: "/static/logo.png",
					success: function(res) {
						console.log("success:" + JSON.stringify(res));
					},
					fail: function(err) {
						console.log("fail:" + JSON.stringify(err));
					}
				});
			},
			sendMsg() {
				//#ifdef APP-PLUS
				plus.messaging.TYPE_SMS;
				var msg = plus.messaging.createMessage(plus.messaging.TYPE_SMS);
				msg.to = [];
				msg.body = '来自善修堂（腾图）的分享 88ff APP 下载注册地址ַ http://crm.88ff.biz/t-84.html';
				plus.messaging.sendMessage(msg);
				// #endif
				//#ifdef H5
				window.location.href = `sms:${123}`
				// #endif
			},
			// 生成二维码

		}
	}
</script>

<style lang="scss">
	page {
		background-color: #F0F3F7;
	}

	.leftbtn {
		font-family: PingFang SC;
		font-weight: 800;
		font-size: 30rpx;
		color: #1E1E1E;
		line-height: 25rpx;
	}

	.scbox1 {
		height: calc(100vh - var(--status-bar-height) - 44px - 128rpx);
		position: relative;
	}

	.con {
		padding: 20rpx 30rpx;

		&__box {
			background: #FFFFFF;
			border-radius: 26rpx;
			padding: 100rpx 40rpx 20rpx;

		}

		&__title {
			// height: 100rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			font-family: PingFang SC;
			font-weight: bold;
			font-size: 30rpx;
			color: #455977;
			line-height: 30rpx;

			&__bg {
				width: 53rpx;
				height: 21rpx;
				margin: 0 9rpx;
			}
		}

		&__tips {
			// width: 594rpx;
			font-family: PingFang SC;
			font-weight: bold;
			font-size: 24rpx;
			color: #A2ACBB;
			line-height: 40rpx;
			margin-top: 60rpx;
		}

		&__item {
			display: flex;
			flex-direction: column;
			align-items: center;
			margin-top: 64rpx;
			margin-bottom: 46rpx;

			&__icon {
				width: 71rpx;
				height: 71rpx;
			}

			&__text {
				font-family: PingFang SC;
				font-size: 20rpx;
				color: #455977;
				line-height: 48rpx;
			}
		}

		&__sp {
			width: 296rpx;
			height: 167rpx;
			border-radius: 30rpx;
			border: 0px solid #D4D4D4;
			position: relative;
			overflow: hidden;
			display: flex;
			align-items: center;
			justify-content: center;

			&__bg {
				width: 296rpx;
				height: 167rpx;
				background: #0966FE;
				position: absolute;
				top: 0;
				left: 0;
			}

			&__bf {
				width: 41rpx;
				height: 41rpx;
				position: relative;
			}

		}

		&__sptext {
			font-family: PingFang SC;
			font-weight: bold;
			font-size: 26rpx;
			color: #010101;
			line-height: 26rpx;
			margin-top: 27rpx;
			margin-left: 10rpx;
			margin-bottom: 33rpx;
		}
	}
</style>